﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using VatTuDTO;
using VatTuBUS1;
using VatTuBUS;

namespace CungUngXayDung
{
    public partial class Temp2 : System.Web.UI.MasterPage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                init();
            }
            LoadLoaiSanPham();
        }
        public void LoadLoaiSanPham( )
        {
            List<LoaiSanPhamDTO> dsloai = new List<LoaiSanPhamDTO>();
            dsloai = new LoaiSanPhamBUS().SelectLoaiSanPham(1);
            listLoaiSanPham1.DataSource = dsloai;
            listLoaiSanPham1.DataBind();
            dsloai = new LoaiSanPhamBUS().SelectLoaiSanPham(2);
            listLoaiSanPham2.DataSource = dsloai;
            listLoaiSanPham2.DataBind();
        }

        public void init()
        {
            GioHangBUS bus = new GioHangBUS();
            lbSoLuongGioHang.Text = bus.DemSoLuongSanPhamGioHang((List<GioHangDTO>)Session["Cart"]).ToString();
            lbTongGiaTri.Text = bus.TinhTongTienGioHang((List<GioHangDTO>)Session["Cart"]).ToString();
        }
       

    }
}